from django.apps import AppConfig
import os

class InvoiceConfig(AppConfig):
    default_auto_field = 'django.db.models.BigAutoField'
    name = 'invoice'

    def ready(self):
        # 避免在 reloader 中重复启动
        if os.environ.get('RUN_MAIN') == 'true' or not os.environ.get('RUN_MAIN'):
            from .mcp_tool import start_mcp_background
            start_mcp_background()